package Common;

import java.util.*;

/** 
 IntArrayList ��ժҪ˵����
*/
public class IntArrayList extends ArrayList
{
	public IntArrayList()
	{
		super();
	}

	private int sum = 0;
	public final int getSum()
	{
		return sum;
	}

	public final int Add(int value)
	{
		sum += value;
		return super.add(value);
	}

	@Override
	public void RemoveAt(int index)
	{
		sum -= (int)super.get(index);
		super.remove(index);
	}

	public final void Remove(int value)
	{
		sum -= value;
		super.remove(value);
	}
	public final void Insert(int index, int value)
	{
		sum += value;
		super.add(index, value);
	}

	@Override
	public void Clear()
	{
		sum = 0;
		super.clear();
	}
	public final int getItem(int index)
	{
		return (int)super.get(index);
	}
	public final void setItem(int index, int value)
	{
		super.set(index, value);
	}
}